package yf.mall.vo.up;


import lombok.Data;

import java.util.Date;

import com.alibaba.excel.annotation.*;

import java.io.Serializable;


import java.math.BigDecimal;

import yf.mall.entity.CouponEntity;
import yf.mall.vo.CouponVo;

                                            import yf.mall.enums.CouponStatusEnum;
    
/**
 * 卡券实体
 * 表名 coupon
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date ${datetime}
 */
@Data
public class CouponUp implements Serializable {
    @ExcelIgnore
    private static final long serialVersionUID = 1L;

                        //
            @ExcelProperty("")
            private Long id;
        
                        //用户
            @ExcelProperty("用户")
            private Long userId;
        
                        //创建时间
            @ExcelProperty("创建时间")
            private Date createTime;
        
                        //过期时间
            @ExcelProperty("过期时间")
            private Date expireTime;
        
                        //产生单号
            @ExcelProperty("产生单号")
            private String fromOrderNo;
        
                        //使用单号
            @ExcelProperty("使用单号")
            private String userOrderNo;
        
                        //面值
            @ExcelProperty("面值")
            private BigDecimal mount;
        
                        //详情
            @ExcelProperty("详情")
            private String info;
        
                        //可使用产品
            @ExcelProperty("可使用产品")
            private String goods;
        
                        //ENUM-状态:"NEW-未使用","USED-已使用"
            @ExcelIgnore
            private Integer status;
                        @ExcelProperty("状态")
            private String statusStr;
        
    
    public CouponUp() {

    }

    public CouponVo toVo() {

        CouponEntity entity = new CouponEntity();
            CouponVo vo = new CouponVo(entity);
                                    entity.setId(id);
            
                                    entity.setUserId(userId);
            
                                    entity.setCreateTime(createTime);
            
                                    entity.setExpireTime(expireTime);
            
                                    entity.setFromOrderNo(fromOrderNo);
            
                                    entity.setUserOrderNo(userOrderNo);
            
                                    entity.setMount(mount);
            
                                    entity.setInfo(info);
            
                                    entity.setGoods(goods);
            
                                    if (getStatusStr() != null) {
                    entity.setStatus(CouponStatusEnum.nameOf(getStatusStr()));
                }
            
        
        return  vo;
    }



}
